import 'package:flutter/cupertino.dart';

///抽屉状态监听
typedef OpenDragListener = void Function(int value);

///抽屉控制器
class DragController {
  OpenDragListener ?_openDragListener;

  ///控制器中添加监听
  setOpenDragListener(OpenDragListener listener) {
    _openDragListener = listener;
  }

  ///打开抽屉
  void open() {
    if (_openDragListener != null) {
      _openDragListener!(1);
    }
  }

  ///关闭抽屉
  void close() {
    if (_openDragListener != null) {
      _openDragListener!(2);
    }
  }
}